package com.yzd.learnjava.io;

import java.io.IOException;
import java.util.ArrayList;

import com.yzd.learnjava.util.Print;

import nu.xom.Builder;
import nu.xom.Document;
import nu.xom.Elements;
import nu.xom.ParsingException;
import nu.xom.ValidityException;

public class People extends ArrayList<Person>{
	public People(String fileName) throws Exception, ParsingException, IOException {
		Document document = new Builder().build(fileName);
		Elements elements = document.getRootElement().getChildElements();
		for(int i = 0 ; i < elements.size(); i++) {
			add(new Person(elements.get(i)));
		}
	}
	public static void main(String[] args) throws Exception, IOException, Exception {
		People people = new People("D:\\src\\git\\java2\\javalearn\\People.xml");
//		People people = new People("People.xml");
		Print.print(people);
	}
}
